import { DailyCompRewardInfo } from "./info/DailyCompRewardInfo";
import { StringHelper } from "../../../com/gengine/utils/StringHelper";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
type int = number;
//class DailyCompleteRewardConfig
    
    export  class DailyCompleteRewardConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            this._list = [];
            if (DailyCompleteRewardConfig._instance != null) 
            {
                throw new Error(" DailyCompleteRewardConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new DailyCompRewardInfo();
                loc1.index = loc2.complete;
                loc1.updateReward(StringHelper.getString(loc2.reward));
                loc1.updateItem(StringHelper.getString(loc2.item));
                this._map[loc1.index] = loc1;
                this._list.push(loc1);
            }
            this._list.sortOn("index", Array.NUMERIC);
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_daily_complete_reward.json");
            this.write(loc1);
            return;
        }

        public getInfoByName(arg1: int): DailyCompRewardInfo
        {
            return this._map[arg1];
        }

        public getAllList(): Array<any>
        {
            return this._list;
        }

        public static get instance(): DailyCompleteRewardConfig
        {
            if (DailyCompleteRewardConfig._instance == null) 
            {
                DailyCompleteRewardConfig._instance = new DailyCompleteRewardConfig();
            }
            return DailyCompleteRewardConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ /* var */_list: Array<any>;

        /* internal */ static /* var */_instance: DailyCompleteRewardConfig;
    }
